package com.health.config;

import com.health.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web环境相关的配置类
 */
//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)  //添加拦截器
                .addPathPatterns("/api/manage/**")        // 拦截以/api/manage开头的所有请求
                .excludePathPatterns("/api/manage/user/login");  // 排除不需要拦截的路径
        //.excludePathPatterns("/api/manage/user/login", "/api/manage/setmeal/upload");  // 排除不需要拦截的路径
    }
}